/*Copyright (C) 2013-2021 LZE*/
#include<bits/stdc++.h>
#define INF 0x7fffffff
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
int f[250]={0},a[250]={0},r[250]={0},n=0,maxn=0;
inline int rd() {
	int x=0;bool ntv=false;char c=getchar();
	while((c<'0'||c>'9')&&c!='-')c=getchar();if(c=='-')ntv=true;else x=(c^48);c=getchar();
	while(c>='0'&&c<='9') {x=x*10+(c^48);c=getchar();}return ntv?-x:x;
}
int main() {
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++)
		for(int j=1;j<i;j++)
			if(a[j]<=a[i])
				if(f[j]+1>=f[i])
				{
					f[i]=f[j]+1;
				}
	int s=0;
	for(int i=1;i<=n;i++)
	{
		if(f[i]>=maxn)
		{
			maxn=f[i];
			s=i;
		}
	}
	cout<<"max="<<maxn+1<<endl;
	return 0;
}
